1. Field of the Invention
The present invention relates to a method and apparatus for conversion of floating-point values between two dissimaler bases or notation systems and handling of conversion anomalies to permit recovery of any lost accuracy.
In recent years, the American National Standards Institute (ANSI) and the Institute of Electrical and Electronic Engineers (IEEE) have provided standards for enhancing and establishing commonality for floating-point notation and processing among the computing industry.
The current engineering/scientific workstation, high-performance mainframe, and supercomputing markets seem to be strongly signalling support of IEEE Standard for Binary Floating-Point Arithmetic (ANSI/IEEE 754-1985) as the industry standard for binary floating-point notation and processing.
Recognizing the significance of both the IEEE standard and the IBM hexadecimal formats in heterogeneous cooperative processing, the preferred embodiment offers an application development facility for floating-point interchange to support coexistence and migration between the ANSI/IEEE notation and IBM hexadecimal floating-point notations used by the ESA/370 and ESA/390 processing systems.
Although prior floating-point conversion aids exist, as shown for example, in U.S. Pat. No. 4,792,793 of Rawlinson, etal and U.S. Pat. No. 4,831,575 of Kuroda, there is need for additional facility that provides enhancements for supporting more accurate heterogenous coexistence and cooperative processing among systems using IBM hexadecimal floating-point facilities and systems using ANSI/IEEE 754-1985 binary floating-point facilities, and facility for analyzing accuracy exposure and hence, balancing system accuracy relative to performance among heterogeneous cooperative processing systems.
Although the method and apparatus disclosed relates to any pair of floating-point notation systems that are not totally coincident in value coverage, a brief description of the relationship between an example pair used in one embodiment is useful to contextually demonstrate the field of the invention.
The IBM hexadecimal floating-point (hereinafter referred to as hexadecimal floating-point) short and the ANSI/IEEE 754-1985 binary floating-point (hereinafter referred to as binary floating-point) single are each 32 bits (and both commonly referred to as real *4), but the field formats and the notation semantics are different from one another. The hexadecimal floating-point long and the binary floating-point double are each 64 bits (and both commonly referred to as real *8), but the field formats and notation semantics also are different from one another.
For a more detailed description of each of the formats, refer to IEEE Standard for Binary Floating-Point Arithmetic (ANSI/IEEE 754-1985) for binary floating-point and to IBM Enterprise Systems Architecture/370 Principles of Operation, SA22-7200, for hexadecimal floating-point.
Although the short and single formats are the same size (32 bits), the field definition is different in size and semantics. The fraction field in both formats may have coincidence in value, but the hexadecimal fraction is actually six sets of four binary digits, hence, the hexadecimal floating-point fraction is multiplied by a power of 16 determined by its characteristic (biased exponent), whereas the binary floating-point fraction is multiplied by a power of 2 determined by its biased exponent.
Furthermore, the normalized hexadecimal floating-point fraction is a number between 0 and 1, whereas the normalized binary floating-point fraction is a number between 1 and 2, and the denormalized binary floating-point fraction is a number between 0 and 1.
Consequently, the binary floating-point format can describe some finer precision numbers than the hexadecimal floating-point format, but the hexadecimal floating-point format can describe a larger range of numbers. The relationship between the short and single formats is illustrated as follows: ##STR1##
The range of numbers and the significant fraction bits for each format follows: ##STR2##
As with the short/single formats, the field sizes and semantics differ, although each use 64 bits. The fractions differ in the same way as the short/single fractions, but the hexadecimal floating-point binary fractions use more bits, and the biased exponent for the binary floating-point multiplier uses more bits. Consequently, the hexadecimal floating-point format can describe some finer precision numbers, but the binary floating-point format can describe a larger range of numbers. The relationship between the short and single formats is illustrated as follows: ##STR3##
The range of numbers and the significant fraction bits for each format follows: ##STR4##
Because the hexadecimal base numbering is periodically consistent with the binary base numbering system (2.sup.4 =16.sup.1), the binary exponent and fraction can be adjusted to fit the exponent harmonics between the two notation systems.
Unfortunately, as the fraction is adjusted to accommodate the periodic equivalence for exponents and the restricted fraction field, low-order significance can be lost. Also, because the fraction field of the binary double notation is smaller than the fraction field of the hexadecimal long notation, low-order significance can be lost during conversion. This loss of precision, or units in the last place (ULPs), can occur when converting from short to single (denormalized result), from single to short and from long to double.
When such a loss occurs, the result may be rounded to provide tolerable accuracy, but the need remains for a facility to detect, compensate, evaluate effect, and permit recovery from this precision loss.
The binary floating-point format also includes a representation for infinity and symbolic entities that are not numbers (NaNs) encoded in the floating-point format, but the hexadecimal floating-point notation does not provide for these symbols.
______________________________________ binary floating-point single In- e=111 1111 1 f=000 0000 0000 0000 0000 0000 finity NaN e=111 1111 1 f=nonzero binary floating-point double In- e=111 1111 1111 f=0000 0000 0000 0000 0000 0000 ... 0000 finity NaN e=111 1111 1111 f=nonzero ______________________________________
For the current invention an anomaly is defined as a floating-point value in a first floating-point notation format that cannot unambiguously, accurately, and completely be represented in the second floating-point notation format. For example, when converting from hexadecimal floating-point short notation format to binary floating-point single notation format, the hexadecimal floating-point values that excede the range of representable binary floating-point values are recognized as anomalies; also, when converting from hexadecimal floating-point long notation format to binary floating-point double notation format, the hexadecimal floating-point values that have finer precision, that is, more significant bits, than can be represented by the binary floating-point notation format are recognized as anomalies; and as further example, when converting from binary floating-point notation formats to hexadecimal floating-point notation formats, the floating-point values previously described as infinity and symbolic entities, which cannot be unambiguously represented by the hexadecimal floating-point notation formats.
Cooperative processing among heterogeneous systems is increasing with the variety of workstation, mainframe, and supercomputing interconnections and ever expanding ways of combining these varied systems to provide entry and display interaction, dynamic visualization of computational processing, large distributed data repositories and data servers for search, retrieval and maintenance, and distributed computational servers to apply greater computational power to problems and reduce elapsed time required to complete problem solutions. The heterogeneous nature of these coupled systems and the asymmetry of the system structure that ensues manifests the need for floating-point data conversion anomaly handling facilities that permit accuracy recovery, accuracy loss analyses, floating-point data characteristic analyses, as well as conversion algorithm selection flexibility.